In some cases, optimization across source files (for example, inline expansion, constant propagation, and the like) is effective for a source file containing a source program written in a programming language such as C, C++, and Fortran. The optimization across source files is performed by confirming all source files based on object files obtained at link time. The optimization across source files performed at link time is called link time optimization (LTO).
When the link time optimization is executed, an object file, which contains an object code generated by compilation executed in accordance with a compilation command (hereinafter referred as first pass compilation) and source program information, is generated. Then, at the link time, optimization is performed using the source program information in the object file, and compilation is executed again on the optimization result (hereinafter referred as second pass compilation). Once the object code as this execution result is linked, build is completed and an executable file is generated.
When the link time optimization is not executed, the object file containing the first pass compilation result is linked. However, when the link time optimization is executed, the object file containing the second pass compilation result is linked; thus, the object file containing the first pass compilation result is not linked.
Related techniques are disclosed in, for example, Japanese Laid-open Patent Publication Nos. 2000-267860, 10-275088, and 2004-152287.